#include <iostream>
#include <string>

using namespace std;



void copyString(char *input, int offset, int length, bool invert, char *output, int output_offset)
{
	int dodaiOutPut = strlen(output) - 1;

	input = strcpy(input, input + offset);

	if (invert == true)
	{
		input = strrev(input);//ham dao chuoi, gan lai cho input dlrow
		strcpy(input, input + length);
		strcpy(output + output_offset, input + 2);
	}
	else
	{
		strcpy(input, input + length);
		strcpy(output + output_offset,input + 2);
	}
}

int main()
{
	//           012345678910
	char st[] = "Hello world";
	//           0123456789101112131415
	char st2[] = "My name is C++";
	copyString(st, 6, 5, true, st2, 11);
	cout<<st2<<endl;
	system("pause");
}